import { createRouter, createWebHistory } from 'vue-router'

const routes = [
    // 根路由重定向到欢迎页
  {
    path: '',
    redirect: '/welcome',
  },
    // 主页的路由及其子路由
  {
    path: '/',
    name: 'home',
    component: () => import(/* webpackChunkName: "about" */ '../views/main.vue'),
    children: [{
      path: "welcome",
      component: () => import(/* webpackChunkName: "about" */ '../views/main/welcome.vue'),
    },{
      path: 'about',
      component: () => import(/* webpackChunkName: "about" */ '../views/main/about.vue'),
    },{
      path: 'batch/',
      children: [{
          path: 'job',
          component: () => import(/* webpackChunkName: "about" */ '../views/main/batch/job.vue'),
      }]
    },{
      path: 'base/',
      children: [{
        path: 'station',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/base/station.vue'),
      },{
        path: 'train',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/base/train.vue'),
      },{
        path: 'train-station',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/base/train-station.vue'),
      },{
        path: 'train-carriage',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/base/train-carriage.vue'),
      },{
        path: 'train-seat',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/base/train-seat.vue'),
      }]
    },{
      path: 'business/',
      children: [{
        path: 'daily-train',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/business/daily-train.vue'),
      }, {
        path: 'daily-train-station',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/business/daily-train-station.vue'),
      }, {
        path: 'daily-train-carriage',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/business/daily-train-carriage.vue'),
      }, {
        path: 'daily-train-seat',
        component: () => import(/* webpackChunkName: "about" */ '../views/main/business/daily-train-seat.vue'),
      }]
    }]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
